package com.zkk.tankgame03;

/**
 * 我的坦克
 * */
public class MyTank extends Tank {

    private final int type = 0;
    private Shot shot = null;//定义一个射击对象（射击线程）

    public Shot getShot() {
        return shot;
    }

    public int getType() {
        return type;
    }

    public MyTank(int x, int y) {
        super(x, y);
    }

    //射击
    public void shotEnemyTank(){
        //创建shot对象，根据当前我方坦克位置和方向
        switch (getDirect()){
            case 0:
                shot = new Shot(this.getX() + 20, this.getY(), 0);
                 break;
            case 1:
                 shot = new Shot(this.getX() + 60, this.getY() + 20, 1);
                 break;
            case 2:
                 shot = new Shot(this.getX() + 20, this.getY() + 60, 2);
                 break;
            case 3:
                 shot = new Shot(this.getX(), this.getY() + 20, 3);
                 break;
        }
        new Thread(shot).start();
    }
}
